﻿@{
    Layout = null;
    string returnUrl = "/Admin/Index"; // ViewBag.ReturnUrl;
}
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>云停车管理平台 -- 登录</title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <link href="/Res/css/bootstrap.min.css?v=3.4.0" rel="stylesheet">
    <link href="/Res/css/font-awesome.min.css?v=4.3.0" rel="stylesheet">    
    <!-- toastr-->
    <link href="/Res/css/plugins/toastr/toastr.min.css" rel="stylesheet">
    <link href="/Res/css/animate.min.css" rel="stylesheet">
    <link href="/Res/css/style.min.css?v=160906" rel="stylesheet">
    <link href="/Res/css/admin.css" rel="stylesheet">
    <script>if (window.top !== window.self) { window.top.location = window.location; }</script>

</head>

<body class="gray-bg">

    <div class="middle-box text-center loginscreen  animated fadeInDown">
        <div>
            <div>
                <h1 class="logo-name">云停车管理平台</h1>
            </div> 
            <form class="m-t" role="form" id="login-form">
                <div class="form-group">
                    <input type="text" id="login-Code" class="form-control" placeholder="企业代码" required="required">
                </div>
                 <div class="form-group">
                    <input type="text" id="login-user" class="form-control" placeholder="用户名" required="required">
                </div>
                <div class="form-group">
                    <input type="password" id="login-pass" class="form-control" placeholder="密码" required="required">
                </div>
                <button type="submit" class="btn btn-primary block full-width m-b">登 录</button>
                <br />
                <p class="text-muted text-center">
                    厦门一指通智能科技有限公司
                    <br/>©2018 www.xmyzt.com.cn
                </p>
                @Html.AntiForgeryToken()
            </form>
        </div>
    </div>
    <a id="redirect_link" style="display:none;" target="_self" href="@returnUrl"></a>

        <!-- 全局js -->
        <script src="/Res/js/jquery-2.1.1.min.js"></script>
        <script src="/Res/js/bootstrap.min.js?v=3.4.0"></script>
        <!-- toastr-->
        <script src="/Res/js/plugins/toastr/toastr.min.js"></script>
        <script src="/Res/js/admin.js"></script>
        <script>
            $(function () {
                $('#login-user').focus();

                $('#login-form').on('submit', function () {
                    var code = $.trim($('#login-Code').val());
                    var user = $.trim($('#login-user').val());
                    var pass = $.trim($('#login-pass').val());

                    if (!user || !pass) {
                        return false;
                    }

                    $.postJsonAjax('/Admin/Login', {enterprise:code, username: user, password: pass }, function (result) {
                        if (result.Code == 1) {
                            document.getElementById('redirect_link').click();
                            //location.href = $('#hidden_returnUrl').val();
                        } else {
                            toastr.warning(result.Message);
                        }
                    });

                    return false;
                });
            });
        </script>

</body>

</html>
